package com.infra.micro.oss.api;

import com.infra.common.resp.PageEx;
import com.infra.common.resp.Response;
import com.infra.micro.oss.fallback.OssBizInfoApiFallback;
import com.infra.micro.oss.model.req.QueryBizInfoReq;
import com.infra.micro.oss.model.vo.BizFileVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Component
@FeignClient(value = "micro-oss-service", path = "/api/oss", fallbackFactory = OssBizInfoApiFallback.class)
public interface OssBizInfoApi {
    /**
     * 根据业务文件ID查询用户文件信息
     *
     * @param bizId
     * @return
     */
    @GetMapping("/bizInfo/{bizId}")
    Response<BizFileVO> queryByBizId(@PathVariable("bizId") Long bizId);

    /**
     * 根据业务文件ID删除文件
     *
     * @param bizId
     * @return
     */
    @DeleteMapping(value = "/bizInfo/{bizId}")
    Response<Boolean> deleteByBizId(@PathVariable("bizId") Long bizId);

    /**
     * 根据条件查询用户文件列表
     *
     * @param bizIds
     * @return
     */
    @PostMapping("/bizInfos")
    Response<List<BizFileVO>> queryByBizIds(@RequestBody List<Long> bizIds);

    /**
     * 根据业务文件ID列表删除文件
     *
     * @param bizIds
     * @return
     */
    @DeleteMapping("/bizInfos")
    Response<Boolean> deleteByBizIds(@RequestBody List<Long> bizIds);

    /**
     * 根据条件分页查询业务文件列表
     *
     * @param req
     * @return
     */
    @GetMapping(value = "/bizInfo/list")
    Response<PageEx<BizFileVO, QueryBizInfoReq>> queryByPage(@SpringQueryMap QueryBizInfoReq req);
}
